﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace CPPEI.Coolzon.Designer.Views
{
    public static class PropertiesCommand
    {
        public static void Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if(UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Solution)
            {
                SolutionProperty window = new SolutionProperty(UIContext.Current.CurrentSolution);
                window.ShowDialog();
            }
            else if(UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Scene)
            {
                Designtime.Metadata.Scene scene = Designtime.Metadata.SolutionHelper.GetScene(UIContext.Current.CurrentSolution, UIContext.Current.CurrentSelectedNode.ID);
                SceneProperty window = new SceneProperty(scene);
                window.ShowDialog();
            }
        }
        public static void CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (UIContext.Current.CurrentSelectedNode != null && (UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Solution || UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Scene))
            {
                e.CanExecute = true;
            }
            else
            {
                e.CanExecute = false;
            }
        }
    }
}
